package com.ld.hpfs.service.impl;


import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.ld.hpfs.dao.RefTitleMapper;
import com.ld.hpfs.service.RefTitleService;
@Service
public class RefTitleServiceImpl implements RefTitleService{
	private static final Logger logger = LoggerFactory.getLogger(RefTitleServiceImpl.class);

	@Autowired
	private RefTitleMapper refTitleMapper;
	

	@Override
	public String[] getRef(String company_id){
		HashMap<String, String> result = refTitleMapper.getRef(company_id);		
		String REF[] = {
				result.get("REF1"),
				result.get("REF2"),
				result.get("REF3"),
				result.get("REF4"),
				result.get("REF5"),
				result.get("REF6"),
				result.get("REF7"),
				result.get("REF8"),
				result.get("REF9"),
				result.get("REF10"),
				result.get("REF11"),
				result.get("REF12"),
				result.get("REF13"),
				result.get("REF14"),
				result.get("REF15"),
				result.get("REF16"),
				result.get("REF17"),
				result.get("REF18"),
				result.get("REF19"),
				result.get("REF20")
		};
		return REF ;
	}
	
	@Override
	public int editRefTitle(HashMap<String,Object> param){
		try{
			refTitleMapper.editRefTitle(param);
			return 0;
		}catch(Exception ex){
			logger.error(ex.getMessage());
			return -1;
		}
	}
	
	@Override
	public int addRefTitle(HashMap<String,Object> param){
		try{
			refTitleMapper.addRefTitle(param);
			return 0;
		}catch(Exception ex){
			logger.error(ex.getMessage());
			return -1;
		}
	}	
	
	@Override
	public HashMap<String,Object> checkRefCompany(HashMap<String,Object> param){
		return refTitleMapper.checkRefCompany(param);
	}
}